package com.sogoodsoft.web.webservice.handler;

import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ResponseLogHandler extends BasicHandler {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    protected Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void invoke(MessageContext msg) throws AxisFault {
        if (logger.isWarnEnabled()) {

            String responseStr = msg.getResponseMessage().getSOAPPartAsString();

            StringBuilder strbuilder = new StringBuilder("\n");
            strbuilder.append("Response SOAP Message :\n");
            strbuilder.append("**************************************************************************\n");
            strbuilder.append(responseStr);
            strbuilder.append("\n**************************************************************************\n");
            logger.warn(strbuilder.toString());
        }
    }

}
